package io.github.uicdb.badskill;

import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.config.ModConfig;

import java.util.List;
import java.util.function.Predicate;

public class BSConfig {

    //BASIC
    public static ForgeConfigSpec.ConfigValue<List<? extends String>> BUTTON_REQUIRES;
    public static ForgeConfigSpec.ConfigValue<List<? extends String>> PRESSURE_PLATE_REQUIRES;



    private static final Predicate<Object> SKILL_PREDICATE = o -> {
        String s = String.valueOf(o);
        System.out.println(o);
        return ResourceLocation.isValidResourceLocation(s);
    };

    public static void registerConfig() {
        ForgeConfigSpec.Builder serverBuilder = new ForgeConfigSpec.Builder();
        serverBuilder.comment("BadSkill Settings");
        BUTTON_REQUIRES = serverBuilder.comment("Button Requires").defineList("ButtonRequires", List.of(), SKILL_PREDICATE);
        PRESSURE_PLATE_REQUIRES = serverBuilder.comment("PressurePlate Requires").defineList("PressurePlateRequires", List.of(), SKILL_PREDICATE);
        ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, serverBuilder.build());
    }
}
